<template>
  <div style="min-height: 400px">
    <tableComponents :pagination="{ currentPage, pageSize, total: list.all_num }" @handleCurrentChange="handleCurrentChange" @handleSizeChange="handleSizeChange" @sendUserSearch="getSearch" :searchData="userSearchData" :isHaveExport="false" :isHaveAdd="false">
      <template v-slot:table>
        <el-table ref="multipleTable" :data="list.data" v-loading="loading" stripe header-row-class-name="head_color" tooltip-effect="dark" style="width: 99.9%" @selection-change="handleSelectionChange">
          <el-table-column label="商品图片" min-width="70">
            <template slot-scope="scope">
              <div class="img_bor">
                <img :src="$fnc.getImgUrl(scope.row.piclink)" alt />
              </div>
            </template>
          </el-table-column>

          <el-table-column label="订单" min-width="200">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>{{ scope.row.title }}</div>
                <div>
                  <span>订单号：</span>
                  <span>{{ scope.row.oid }}</span>
                </div>
                <div>
                  <span>订单类型：</span>
                  <span>{{ scope.row.types_cn }}</span>
                </div>
                <div>
                  <span>退货时间：</span>
                  <span>{{ scope.row.return_time | getTimeFormat }}</span>
                </div>
                <div v-if="scope.row.admin_remark">
                  <span>管理员备注：</span>
                  <span>{{ scope.row.admin_remark }}</span>
                </div>

              </div>
            </template>
          </el-table-column>

          <el-table-column label="商家信息" min-width="120">
            <template slot-scope="scope">
              <div class="tab_div" v-if="scope.row.sid > 0">
                <div>
                  <span>店铺名称：</span>
                  <span>{{ scope.row.sid_title || "---" }}</span>
                </div>
                <div>
                  <span>商家账号：</span>
                  <span>{{ scope.row.sid_username || "---" }}</span>
                </div>
                <div>
                  <span>商家昵称：</span>
                  <span>{{ scope.row.sid_nickname || "---" }}</span>
                </div>
              </div>
              <div v-else>平台自营</div>
            </template>
          </el-table-column>

          <el-table-column label="用户头像" min-width="70">
            <template slot-scope="scope">
              <div class="img_bor_tx">
                <img :src="$fnc.getImgUrl(scope.row.avatar)" alt />
              </div>
            </template>
          </el-table-column>

          <el-table-column label="退款用户" min-width="140">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>
                  <span>用户昵称：</span>
                  <span>{{ scope.row.nickname }}</span>
                </div>
                <div>
                  <span>会员账号：</span>
                  <span>{{ scope.row.username }}</span>
                </div>
                <div>
                  <span>用户等级：</span>
                  <span class="rat" v-show="scope.row.rating_cn">{{
                    scope.row.rating_cn
                  }}</span>
                </div>
              </div>
            </template>
          </el-table-column>

          <el-table-column label="退货物流" min-width="140">
            <template slot-scope="scope">
              <div class="tab_div">
                <div>
                  <span>快递公司：</span>
                  <span>{{ scope.row.return_mail || "----" }}</span>
                </div>
                <div>
                  <span>运单号：</span>
                  <span>{{ scope.row.return_oid || "----" }}</span>
                </div>
              </div>
            </template>
          </el-table-column>

          <el-table-column label="商品状态" min-width="120">
            <template slot-scope="scope">
              <div class="tab_div">
                <template v-if="scope.row.types == 43">
                  <div style="margin-top: 10px">
                    <span>退货类型：{{
                        scope.row.aftersale_type == 0
                          ? "售后退货退款"
                          : scope.row.aftersale_type == 1
                          ? "售后仅退款"
                          : scope.row.aftersale_type == 2
                          ? "发货前退款"
                          : scope.row.aftersale_type == 3
                          ? "换货"
                          : scope.row.aftersale_type == 4
                          ? "系统取消"
                          : scope.row.aftersale_type == 5
                          ? "用户取消"
                          : scope.row.aftersale_type == 6
                          ? "价保"
                          : scope.row.aftersale_type == 7
                          ? "补寄"
                          : scope.row.aftersale_type == 8
                          ? "维修"
                          : "----"
                      }}</span>
                    <span></span>
                  </div>
                  <div v-if="scope.row.types == 43">
                    <span></span>
                    <span v-if="scope.row.aftersale_status == 6" class="rat">
                      售后申请
                    </span>
                    <span v-if="scope.row.aftersale_status == 7" class="rat">
                      售后退货中
                    </span>
                    <span v-if="scope.row.aftersale_status == 8" class="rat">
                      补寄\维修：售后待商家发货
                    </span>
                    <span v-if="scope.row.aftersale_status == 11" class="rat">
                      售后已发货
                    </span>
                    <span v-if="scope.row.aftersale_status == 12" class="rat">
                      售后成功
                    </span>
                    <span v-if="scope.row.aftersale_status == 13" class="rat">
                      换货\补寄\维修：售后商家已发货，待用户收货
                    </span>
                    <span v-if="scope.row.aftersale_status == 14" class="rat">
                      换货\补寄\维修：售后用户已收货
                    </span>
                    <span v-if="scope.row.aftersale_status == 27" class="rat">
                      拒绝售后申请
                    </span>
                    <span v-if="scope.row.aftersale_status == 28" class="rat">
                      售后失败
                    </span>
                    <span v-if="scope.row.aftersale_status == 29" class="rat">
                      售后退货拒绝
                    </span>
                    <span v-if="scope.row.aftersale_status == 51" class="rat">
                      订单取消成功
                    </span>
                    <span v-if="scope.row.aftersale_status == 53" class="rat">
                      逆向交易已完成
                    </span>
                  </div>
                </template>

                <template v-else>
                  <div>
                    <span>申请状态</span>
                    <span></span>
                  </div>
                  <div>
                    <span></span>
                    <span v-if="scope.row.status == 1" class="rat">{{
                      scope.row.is_virtual == 1 ? "申请退款" : "申请退货"
                    }}</span>
                    <span v-if="scope.row.status == 2 && scope.row.types != 37" class="rat">
                      {{
                        scope.row.is_virtual == 1 ? "允许退款" : "允许退货"
                      }}</span>
                    <span v-if="scope.row.status == 3" class="rat">
                      {{
                        scope.row.types == 37
                          ? "合同待退款"
                          : scope.row.types == 35
                          ? "待退款"
                          : scope.row.is_virtual == 1
                          ? "未发货待退款"
                          : "已退货待退款"
                      }}
                    </span>
                    <span v-if="scope.row.status == 4" class="rat">
                      {{
                        scope.row.types == 37
                          ? "合同退款成功"
                          : scope.row.is_virtual == 1
                          ? "退款成功"
                          : "退货成功"
                      }}
                    </span>

                    <span v-if="scope.row.status == 6" class="rat">
                      仅退款，待审核中
                    </span>
                  </div>
                </template>
              </div>
            </template>
          </el-table-column>

          <el-table-column label="操作" align="center" min-width="150">
            <template slot-scope="scope">
              <el-button :loading="$store.state.isLoading" size="mini" :type="scope.row.status == 4 ? 'primary' : 'danger'" @click="showEditDialog(scope.$index, scope.row)">{{ scope.row.status == 4 ? "查看" : "审核退货" }}</el-button>&nbsp;&nbsp;&nbsp;&nbsp;
              <!-- <el-button  :loading='$store.state.isLoading'
                size="mini"
                @click="refuseReturn(scope.$index, scope.row)"
                v-if="scope.row.status==1"
                type="danger"
              >驳回</el-button>-->
            </template>
          </el-table-column>
        </el-table>
      </template>
    </tableComponents>
    <el-dialog :close-on-click-modal="false" title="退货管理" :visible.sync="dialogTableVisible" class="tl size_13" @close="reload()" width="800px">
      <el-form :model="myform" class="mar_top" label-width="120px">
        <el-form-item label="订单号">
          <el-col :span="12">
            <el-input :disabled="true" placeholder v-model="myform.oid" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="订单产品">
          <el-col :span="12">
            <el-input :disabled="true" placeholder v-model="myform.title" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="订单类型">
          <el-col :span="12">
            <el-input :disabled="true" placeholder v-model="myform.types_cn" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="快递公司" v-if="myform.status != 2 && myform.types != 37 && myform.types != 35">
          <el-col :span="12">
            <el-input :disabled="true" placeholder v-model="myform.return_mail" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="运单号" v-if="myform.status != 2 && myform.types != 37 && myform.types != 35">
          <el-col :span="12">
            <el-input :disabled="true" placeholder v-model="myform.return_oid" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="退款原因">
          <el-col :span="12">
            <el-input :disabled="true" placeholder v-model="myform.return_reason" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="退款图片" v-if="myform.pic && myform.pic.length > 0">
          <div style="
              display: flex;
              flex-wrap: wrap;
              justify-content: flex-start;
              align-items: center;
            ">
            <div style="
                width: 150px;
                height: 150px;
                overflow: hidden;
                display: flex;
                justify-content: center;
                align-items: center;
                margin-right: 10px;
                margin-bottom: 10px;
              " v-for="(item, i) in myform.pic" :key="i">
              <el-popover placement="right" title trigger="hover">
                <img :src="item.piclink" style="width: 100%; min-height: 100%" />
                <img slot="reference" :src="item.piclink" :alt="item.piclink" style="width: 100%; min-height: 100%" />
              </el-popover>
            </div>
          </div>
        </el-form-item>

        <el-form-item label="退货说明">
          <el-col :span="12">
            <el-input :disabled="true" placeholder type="textarea" v-model="myform.return_instructions" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="退款金额">
          <el-col :span="12">
            <el-input placeholder v-model="myform.return_money" clearable :disabled="myform.status == 4"></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="退货类型" required v-if="myform.types == 43">
          <el-col :span="24" class="tl">
            <div v-if="myform.aftersale_type == 0">
              <el-radio v-model="myform.status" label="101">
                同意退货申请（一次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="102">
                拒绝退货申请（一次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="111">
                同意退货（二次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="112">
                拒绝退货（二次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="121">
                退货转退款
              </el-radio>
            </div>
            <div v-if="myform.aftersale_type == 1">
              <el-radio v-model="myform.status" label="201">
                同意仅退款
              </el-radio>
              <el-radio v-model="myform.status" label="202">
                拒绝仅退款
              </el-radio>
              <el-radio v-model="myform.status" label="203">
                同意拒签后退款
              </el-radio>
            </div>
            <div v-if="myform.aftersale_type == 3">
              <el-radio v-model="myform.status" label="301">
                同意换货申请（一次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="302">
                拒绝换货申请（一次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="311">
                同意换货（二次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="312">
                拒绝换货（二次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="321">
                换货转退款
              </el-radio>
            </div>
            <div v-if="myform.aftersale_type == 7">
              <el-radio v-model="myform.status" label="501">
                同意补寄
              </el-radio>
              <el-radio v-model="myform.status" label="502">
                拒绝补寄
              </el-radio>
            </div>
            <div v-if="myform.aftersale_type == 8">
              <el-radio v-model="myform.status" label="601">
                同意维修申请，需买家退货（一次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="602">
                同意维修申请，无需买家退货（一次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="603">
                拒绝维修申请（一次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="611">
                同意维修申请，立即发货（二次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="612">
                拒绝维修申请（二次审核）
              </el-radio>
              <el-radio v-model="myform.status" label="621">
                维修转退款
              </el-radio>
            </div>
          </el-col>
        </el-form-item>

        <el-form-item label="申请状态" required v-else>
          <el-col :span="24" class="tl">
            <template v-if="myform.types == 35">
              <div>
                <el-radio v-model="myform.status" label="0">驳回退款</el-radio>
                <el-radio v-model="myform.status" disabled label="3">
                  待退款
                </el-radio>
                <el-radio v-model="myform.status" label="4">
                  退款成功
                </el-radio>
              </div>
            </template>
            <template v-else-if="myform.types == 37">
              <div>
                <el-radio v-model="myform.status" label="0">驳回退款</el-radio>
                <el-radio v-model="myform.status" disabled label="3">
                  合同待退款
                </el-radio>
                <el-radio v-model="myform.status" label="4">
                  退款成功
                </el-radio>
              </div>
            </template>
            <template v-else>
              <div v-if="radio == 1">
                <el-radio v-model="myform.status" label="0">{{
                  myform.is_virtual == 1 ? "驳回退款" : "驳回退货"
                }}</el-radio>
                <el-radio v-model="myform.status" label="1">{{
                  myform.is_virtual == 1 ? "申请退款" : "申请退货"
                }}</el-radio>
                <el-radio v-model="myform.status" label="2">
                  {{
                    myform.is_virtual == 1 ? "允许退款" : "允许退货"
                  }}</el-radio>
                <el-radio v-model="myform.status" disabled label="3">
                  {{ myform.is_virtual == 1 ? "未发货待退款" : "已退货待退款" }}
                </el-radio>
                <el-radio v-model="myform.status" disabled label="4">{{
                  myform.is_virtual == 1 ? "退款完成" : "退货完成"
                }}</el-radio>
              </div>
              <div v-else-if="radio == 2 || radio == 4">
                <el-radio v-model="myform.status" label="0">{{
                  myform.is_virtual == 1 ? "驳回退款" : "驳回退货"
                }}</el-radio>
                <el-radio v-model="myform.status" label="1" disabled>{{
                  myform.is_virtual == 1 ? "申请退款" : "申请退货"
                }}</el-radio>
                <el-radio v-model="myform.status" label="2" disabled>
                  {{
                    myform.is_virtual == 1 ? "允许退款" : "允许退货"
                  }}</el-radio>
                <el-radio v-model="myform.status" label="3" disabled>
                  {{
                    myform.is_virtual == 1 ? "未发货待退款" : "已退货待退款"
                  }}</el-radio>
                <el-radio v-model="myform.status" label="4" disabled>{{
                  myform.is_virtual == 1 ? "退款完成" : "退货完成"
                }}</el-radio>
              </div>
              <div v-else-if="radio == 3">
                <el-radio v-model="myform.status" label="0">{{
                  myform.is_virtual == 1 ? "驳回退款" : "驳回退货"
                }}</el-radio>
                <el-radio v-model="myform.status" label="1" disabled>{{
                  myform.is_virtual == 1 ? "申请退款" : "申请退货"
                }}</el-radio>
                <el-radio v-model="myform.status" label="2" disabled>
                  {{
                    myform.is_virtual == 1 ? "允许退款" : "允许退货"
                  }}</el-radio>
                <el-radio v-model="myform.status" label="3" disabled>
                  {{
                    myform.is_virtual == 1 ? "未发货待退款" : "已退货待退款"
                  }}</el-radio>
                <el-radio v-model="myform.status" label="4">{{
                  myform.is_virtual == 1 ? "退款完成" : "退货完成"
                }}</el-radio>
              </div>
              <div v-else-if="radio == 6">
                <el-radio v-model="myform.status" label="0">驳回退货</el-radio>
                <el-radio v-model="myform.status" label="4">退款完成</el-radio>
              </div>
            </template>
          </el-col>
        </el-form-item>

        <template v-if="myform.types == 43">
          <el-form-item label="地址" v-if="
              myform.status == '101' &&
              myform.status == '301' &&
              myform.status == '601'
            ">
            <el-col :span="20">
              <el-select v-model="myform.address_id" placeholder="请选择" @visible-change="getAddrssList" :loading="addLoading">
                <el-option v-for="(item, i) in address_lists" :key="i" :value="item.address_id" :label="
                    item.receiver_provinc +
                    item.receiver_city +
                    item.receiver_district +
                    item.receiver_street +
                    item.receiver_detail +
                    '-' +
                    item.reciever_name
                  ">
                </el-option>
              </el-select>
            </el-col>
          </el-form-item>
        </template>
        <template v-else>
          <el-form-item label="收件人姓名" v-if="myform.types != 37 && myform.types != 35">
            <el-col :span="12">
              <el-input :disabled="myform.status != 1 && myform.status != 2" placeholder v-model="myform.return_name" clearable>
              </el-input>
            </el-col>
          </el-form-item>

          <el-form-item label="收件人电话" v-if="myform.types != 37 && myform.types != 35">
            <el-col :span="12">
              <el-input :disabled="myform.status != 1 && myform.status != 2" placeholder v-model="myform.return_tel" clearable>
              </el-input>
            </el-col>
          </el-form-item>

          <el-form-item label="收件人地址" v-if="myform.types != 37 && myform.types != 35">
            <el-col :span="12">
              <el-input :disabled="myform.status != 1 && myform.status != 2" placeholder v-model="myform.return_address" clearable>
              </el-input>
            </el-col>
          </el-form-item>
        </template>

        <el-form-item label="管理员备注">
          <el-col :span="12">
            <el-input type="textarea" placeholder v-model="myform.admin_remark" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-button :loading="$store.state.isLoading" size="medium" type="primary" @click.prevent="subForm()">确定</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>
<script>
import switchc from "../currency/Swich";
import HeadTitle from "@/components/currency/HeadTitle.vue";
import returenedSearch from "@/components/currency/returenedSearch.vue";
import { orderReturnedSearchData } from "@/assets/js/searchData/searchData"; //引入搜索的数据
export default {
  name: "returned",
  data() {
    return {
      userSearchData: orderReturnedSearchData,
      show: false,
      myshow: false,
      dialogTableVisible: false,
      loading: false,
      list: [],
      allPage: 0,
      allNum: 0,
      pageSize: 10,
      currentPage: 1,
      editId: "",
      multipleSelection: "",
      arr: [],
      visible: false,
      clickNum: 1,
      updataIndex: "",
      myform: {},
      searchAll: {
        oid: "",
      },
      radio: "1",
      address_lists: [],
      addLoading: false,
    };
  },
  components: {
    switchc,
    HeadTitle,
    returenedSearch,
  },
  methods: {
    getAddrssList(val) {
      if (val) {
        this.skuLoading = true;
        this.$api.getSupplier.doudian_address_list({}).then((res) => {
          if (res.data.code == 200) {
            this.address_lists = res.data.result;
            this.skuLoading = false;
          }
        });
      }
    },
    imgError(item) {
      if (!item) {
        return require("../../assets/img/default_head.png");
      }
      if (item.indexOf("http") >= 0) {
        return item;
      } else {
        return "/api/" + item;
      }
    },
    showAddDialog() {
      this.show = true;
    },
    getSearch(obj) {
      this.searchAll = obj;
      this.$router.push(this.$route.path + "?page=" + 1);
      this.getNewsAll(obj);
    },
    getNewsAll(data) {
      this.loading = true;
      var params = {};
      data = data || {};

      params = data;
      this.$api.getUser.getReturnList(params).then((res) => {
        if (res.data.code == 200) {
          this.list = res.data.result;
        }
        this.loading = false;
      });
    },
    handleSizeChange(val) {
      var params = this.searchAll;
      params.page = "";
      params.page_size = val;
      this.getNewsAll(params);
      this.pageSize = val;
    },
    handleCurrentChange(val) {
      this.$router.push(this.$route.path + "?page=" + val);
    },
    handleSwitch(val, id) {
      //审核
      var params = {};
      params["id"] = id;
      val == true ? (params["is_check"] = 1) : (params["is_check"] = 0);
      this.$api.getUser.msgCheck(params).then((res) => {
        if (res.data.code == 400) {
          this.$fnc.alertError(res.data.result, res.data.code_desc);
        }
      });
    },
    handleSelectionChange(val) {
      //多选框赋值
      this.multipleSelection = val;
    },
    delSelection() {
      //删除
      this.$swal({
        title: "您确定要删除这条信息吗",
        text: "删除后将无法恢复，请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "是的，我要删除",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          var str = "";
          for (var i in this.multipleSelection) {
            str += this.multipleSelection[i].id + "@";
          }
          str = str.slice(0, -1);

          var data = { id_str: str };
          this.$api.getUser.extractDel(data).then((res) => {
            if (res.data.code == 200) {
              this.getNewsAll();
            }
          });
        }
      });
    },
    deleteNew(index, id) {
      this.$swal({
        title: "您确定要删除这条信息吗",
        text: "删除后将无法恢复，请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "是的，我要删除",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          var data = { id_str: id };
          this.$api.getUser.extractDel(data).then((res) => {
            if (res.data.code == 200) {
              this.$swal("删除成功！", "您已经删除了这条信息。", "success");

              this.getNewsAll();
            } else {
              this.$swal("删除失败！", "出错啦！", "success");
            }
          });
        }
      });
    },
    refuseReturn(index, vo) {
      this.$swal({
        title: "您确定要驳回吗",
        text: "驳回后将无法恢复，请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "是的，我要驳回",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          var data = {};
          data["goods_id"] = vo.id;
          data["status"] = 0;
          this.$api.getUser.orderRebackGoods(data).then((res) => {
            if (res.data.code == 200) {
              this.$swal("操作成功！", "您已经驳回了退货申请。", "success");

              this.getNewsAll();
            } else {
              this.$swal("操作失败！", "出错啦！", "success");
            }
          });
        }
      });
    },
    showEditDialog(index, vo) {
      this.radio = vo.status;
      console.log(vo);
      this.myform = JSON.parse(JSON.stringify(vo));
      if (vo.return_money > 0) {
        this.myform.return_money = this.$fnc.toFixedZ(vo.return_money);
      } else {
        this.myform.return_money = this.$fnc.toFixedZ(vo.money);
      }
      if (vo.types == 43) {
        this.myform.status = "";
        this.myform.address_id = "";
      }
      this.dialogTableVisible = true;
      this.clickNum++;
    },
    reload() {
      this.getNewsAll(this.searchAll);
    },
    subForm() {
      var data = {};
      data["goods_id"] = this.myform.id;
      if (this.myform.types == 43) {
        data["types"] = this.myform.status;
        if (
          this.myform.status == 101 ||
          this.myform.status == 301 ||
          this.myform.status == 601
        ) {
          data["address_id"] = this.myform.address_id;
        }
        delete data["pic"];
        this.visible = false;
        this.$api.getSupplier.doudian_reback_goods(data).then((res) => {
          if (res.data.status == 1 && res.data.code == 200) {
            this.$fnc.alertSuccess({ text: "添加成功" });
            this.dialogTableVisible = false;
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
      } else {
        data["status"] = this.myform.status;
        data["return_name"] = this.myform.return_name;
        data["return_tel"] = this.myform.return_tel;
        data["return_address"] = this.myform.return_address;
        data["admin_remark"] = this.myform.admin_remark;
        data["return_money"] = this.myform.return_money;
        delete data["pic"];
        this.visible = false;
        this.$api.getUser.orderRebackGoods(data).then((res) => {
          if (res.data.status == 1 && res.data.code == 200) {
            this.$fnc.alertSuccess({ text: "添加成功" });
            this.dialogTableVisible = false;
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
      }
    },
  },

  created() {
    console.log(this.$route);
    if (this.$route.query.oid) {
      this.searchAll.oid = this.$route.query.oid;
    }
    this.getNewsAll(this.searchAll);
  },
  watch: {
    $route() {
      var params = this.searchAll;
      params.page = this.$route.query.page || 1;
      params.page_size = this.pageSize;
      this.getNewsAll(params);
      this.currentPage = Number(this.$route.query.page) || 1;
    },
  },
};
</script>
